home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.004 / xemacs-1 / xemacs-19.13 / src / device-tty.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-10  |  7.7 KB  |  251 lines

  1. /* Define TTY specific device object for XEmacs.
  2.    Copyright (C) 1995 Board of Trustees, University of Illinois
  3.  
  4. This file is part of XEmacs.
  5.  
  6. XEmacs is free software; you can redistribute it and/or modify it
  7. under the terms of the GNU General Public License as published by the
  8. Free Software Foundation; either version 2, or (at your option) any
  9. later version.
  10.  
  11. XEmacs is distributed in the hope that it will be useful, but WITHOUT
  12. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14. for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with XEmacs; see the file COPYING.  If not, write to the Free
  18. Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /* Synched up with: Not in FSF. */
  21.  
  22. /* Written by Chuck Thompson. */
  23.  
  24. #ifndef _XEMACS_DEVICE_TTY_H_
  25. #define _XEMACS_DEVICE_TTY_H_
  26.  
  27. #include "device.h"
  28. #include "syssignal.h" /* Always include before systty.h */
  29. #include "systty.h"
  30.  
  31. DECLARE_DEVICE_TYPE (tty);
  32.  
  33. struct tty_device
  34. {
  35.   FILE *infd, *outfd;
  36.   Lisp_Object tty, terminal_type;
  37.   char *term_entry_buffer;
  38. #ifdef HAVE_TERMIOS
  39.   speed_t ospeed;        /* Output speed (from sg_ospeed) */
  40. #else
  41.   short ospeed;            /* Output speed (from sg_ospeed) */
  42. #endif
  43.  
  44.   /* Physical location of cursor on this device. */
  45.   int cursor_x;
  46.   int cursor_y;
  47.  
  48.   int height;
  49.   int width;
  50.  
  51.   /* flags indicating presence, absence or value of various features */
  52.   struct
  53.   {
  54.     unsigned int must_write_spaces :1;    /* terminal inserts nulls, not
  55.                        spaces to fill whitespace
  56.                        on screen */
  57.     unsigned int insert_mode_motion :1;    /* cursor movement commands
  58.                        work while in insert mode */
  59.     unsigned int standout_motion :1;    /* cursor movement is graceful
  60.                        in standout or underline mode */
  61.     unsigned int memory_above_frame :1;    /* display retained above screen */
  62.     unsigned int memory_below_frame :1;    /* display retained below screen */
  63.     unsigned int meta_key :2;        /* 0 == mask off top bit;
  64.                        1 == top bit is meta;
  65.                        2 == top bit is useful as
  66.                        character info */
  67.     unsigned int flow_control :1;    /* Nonzero means use ^S/^Q as
  68.                        cretinous flow control.  */
  69.     int standout_width;            /* # of spaces printed when
  70.                        change to standout mode */
  71.     int underline_width;        /* # of spaces printed when
  72.                        change to underline mode */
  73.   } flags;
  74.  
  75.   /* cursor motion entries - each entry is commented with the terminfo
  76.      and the termcap entry */
  77.   struct
  78.   {
  79.     /* local cursor movement */
  80.     CONST char *up;            /* cuu1, up */
  81.     CONST char *down;            /* cud1, do */
  82.     CONST char *left;            /* cub1, le */
  83.     CONST char *right;            /* cuf1, nd */
  84.     CONST char *home;            /* home, ho */
  85.     CONST char *low_left;        /* ll, ll */
  86.     CONST char *car_return;        /* cr, cr */
  87.  
  88.     /* parameterized local cursor movement */
  89.     CONST char *multi_up;        /* cuu, UP */
  90.     CONST char *multi_down;        /* cud, DO */
  91.     CONST char *multi_left;        /* cub, LE */
  92.     CONST char *multi_right;        /* cuf, RI */
  93.  
  94.     /* absolute cursor motion */
  95.     CONST char *abs;            /* cup, cm */
  96.     CONST char *hor_abs;        /* hpa, ch */
  97.     CONST char *ver_abs;        /* vpa, cv */
  98.  
  99.     /* scrolling */
  100.     CONST char *scroll_forw;        /* ind, sf */
  101.     CONST char *scroll_back;        /* ri, sr */
  102.     CONST char *multi_scroll_forw;    /* indn, SF */
  103.     CONST char *multi_scroll_back;    /* rin, SR */
  104.     CONST char *set_scroll_region;    /* csr, cs */
  105.   } cm;
  106.  
  107.   /* screen editing entries - each entry is commented with the
  108.      terminfo and the termcap entry */
  109.   struct
  110.   {
  111.     /* adding to the screen */
  112.     CONST char *ins_line;        /* il1, al */
  113.     CONST char *multi_ins_line;        /* il, AL */
  114.     CONST char *repeat;            /* rep, rp */
  115.     CONST char *begin_ins_mode;        /* smir, im */
  116.     CONST char *end_ins_mode;        /* rmir, ei */
  117.     CONST char *ins_char;        /* ich1, ic */
  118.     CONST char *multi_ins_char;        /* ich, IC */
  119.     CONST char *insert_pad;        /* ip, ip */
  120.  
  121.     /* deleting from the screen */
  122.     CONST char *clr_frame;        /* clear, cl */
  123.     CONST char *clr_from_cursor;    /* ed, cd */
  124.     CONST char *clr_to_eol;        /* el, ce */
  125.     CONST char *del_line;        /* dl1, dl */
  126.     CONST char *multi_del_line;        /* dl, DL */
  127.     CONST char *del_char;        /* dch1, dc */
  128.     CONST char *multi_del_char;        /* dch, DC */
  129.     CONST char *begin_del_mode;        /* smdc, dm */
  130.     CONST char *end_del_mode;        /* rmdc, ed */
  131.     CONST char *erase_at_cursor;    /* ech, ec */
  132.   } se;
  133.  
  134.   /* screen display entries - each entry is commented with the
  135.      terminfo and termcap entry */
  136.   struct
  137.   {
  138.     CONST char *begin_standout;        /* smso, so */
  139.     CONST char *end_standout;        /* rmso, se */
  140.     CONST char *begin_underline;    /* smul, us */
  141.     CONST char *end_underline;        /* rmul, ue */
  142.     CONST char *begin_alternate;    /* smacs, as */
  143.     CONST char *end_alternate;        /* rmacs, ae */
  144.  
  145.     CONST char *turn_on_reverse;    /* rev, mr */
  146.     CONST char *turn_on_blinking;    /* blink, mb */
  147.     CONST char *turn_on_bold;        /* bold, md */
  148.     CONST char *turn_on_dim;        /* dim, mh */
  149.     CONST char *turn_off_attributes;    /* sgr0, me */
  150.  
  151.     CONST char *visual_bell;        /* flash, vb */
  152.     CONST char *audio_bell;        /* bel, bl */
  153.  
  154.     CONST char *cursor_visible;        /* cvvis, vs */
  155.     CONST char *cursor_normal;        /* cnorm, ve */
  156.     CONST char *init_motion;        /* smcup, ti */
  157.     CONST char *end_motion;        /* rmcup, te */
  158.     CONST char *keypad_on;        /* smkx, ks */
  159.     CONST char *keypad_off;        /* rmkx, ke */
  160.   } sd;
  161.  
  162.   /* costs of various operations */
  163.   struct
  164.   {
  165.     int cm_up;
  166.     int cm_down;
  167.     int cm_left;
  168.     int cm_right;
  169.     int cm_home;
  170.     int cm_low_left;
  171.     int cm_car_return;
  172.     int cm_abs;
  173.     int cm_hor_abs;
  174.     int cm_ver_abs;
  175.   } cost;
  176.  
  177.   /* The initial tty mode bits */
  178.   struct emacs_tty old_tty;
  179.  
  180.   /* Is this TTY our controlling terminal? */
  181.   int controlling_terminal :1;
  182. };
  183.  
  184. #define DEVICE_TTY_DATA(d) DEVICE_TYPE_DATA (d, tty)
  185. #define DEVICE_TTY_CURSOR_X(d) (DEVICE_TTY_DATA (d)->cursor_x)
  186. #define DEVICE_TTY_CURSOR_Y(d) (DEVICE_TTY_DATA (d)->cursor_y)
  187.  
  188. #define TTY_CM(d) (DEVICE_TTY_DATA (d)->cm)
  189. #define TTY_SE(d) (DEVICE_TTY_DATA (d)->se)
  190. #define TTY_SD(d) (DEVICE_TTY_DATA (d)->sd)
  191. #define TTY_FLAGS(d) (DEVICE_TTY_DATA (d)->flags)
  192. #define TTY_COST(d) (DEVICE_TTY_DATA (d)->cost)
  193.  
  194. #define TTY_INC_CURSOR_X(d, n) (DEVICE_TTY_CURSOR_X (d) += n)
  195. #define TTY_INC_CURSOR_Y(d, n) (DEVICE_TTY_CURSOR_Y (d) += n)
  196.  
  197. /* termcap requires this to be global */
  198. #ifdef HAVE_TERMIOS
  199. extern speed_t ospeed;        /* Output speed (from sg_ospeed) */
  200. #else
  201. extern short ospeed;        /* Output speed (from sg_ospeed) */
  202. #endif
  203.  
  204. extern FILE *termscript;
  205.  
  206.  
  207. /******************     Prototypes from cm.c     *******************/
  208.  
  209. /* #### Verify that all of these are still needed. */
  210.  
  211. extern void cm_cost_init (struct device *d);
  212. extern void cmputc (int c);
  213. extern void cmgoto (struct frame *f, int row, int col);
  214. extern struct device *cmputc_device;
  215.  
  216.  
  217. /***************     Prototypes from device-tty.c     ****************/
  218.  
  219. extern void init_event_tty_late (void);
  220.  
  221.  
  222. /***************     Prototypes from event-tty.c     ****************/
  223.  
  224. extern int read_event_from_tty_or_stream_desc (struct Lisp_Event *event,
  225.                            struct device *d, int fd);
  226. extern int maybe_read_quit_event (struct Lisp_Event *event);
  227.  
  228.  
  229. /***************     Prototypes from redisplay-tty.c     ****************/
  230.  
  231. enum term_init_status
  232. {
  233.   TTY_UNABLE_OPEN_DATABASE,
  234.   TTY_TYPE_UNDEFINED,
  235.   TTY_TYPE_INSUFFICIENT,
  236.   TTY_SIZE_UNSPECIFIED,
  237.   TTY_INIT_SUCCESS
  238. };
  239.  
  240. extern int init_tty_for_redisplay (struct device *d, char *terminal_type);
  241. /* #### These should probably be methods. */
  242. void set_tty_modes (struct device *d);
  243. void reset_tty_modes (struct device *d);
  244.  
  245.  
  246. /* #### sysdep.c currently needs this.  I think this is wrong. */
  247. extern void tty_clear_region (Lisp_Object locale, face_index findex, int x,
  248.                   int y, int width, int height);
  249.  
  250. #endif /* _XEMACS_DEVICE_TTY_H_ */
  251.